package goose

import (
	"gitee.com/chencanxin/goose/logger"
	"strings"
)

func init() {
	GooseLogger.SetLevel(logger.LevelDebug)
	GooseLogger.Async()
	GooseLogger.EnagleFuncCallDepth(true)

}

// GooseLogger references the used application logger.
var GooseLogger = logger.GetDefaultLogger()

// Error logs a message at error level.
func Error(v ...interface{}) {
	GooseLogger.Error(generateFmtStr(len(v)), v...)
}

// Warn compatibility alias for Warning()
func Warn(v ...interface{}) {
	GooseLogger.Warn(generateFmtStr(len(v)), v...)
}

// Info compatibility alias for Warning()
func Info(v ...interface{}) {
	GooseLogger.Info(generateFmtStr(len(v)), v...)
}

// Debug logs a message at debug level.
func Debug(v ...interface{}) {
	GooseLogger.Debug(generateFmtStr(len(v)), v...)
}

func generateFmtStr(n int) string {
	return strings.Repeat("%v ", n)
}
